import re
import requests

base_url = r'http://172.16.22.108:8080/bsams/front'

# 登录
url = base_url + '/login.do'
data = {
    'taskId':'1',
    'loginName':'test03',
    'password':'123456',
    'vericode':'shtd'
}
# headers = {
#     'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
#     'Content-Type':'application/x-www-form-urlencoded'
# }
resp = requests.post(url, data=data)
print(resp.cookies.get_dict())

patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)
# cookies = resp.cookies.get_dict()

cookies = {'JSESSIONID': '96A60DA911A672B95D968C1E51FFEDD9'}
# 个人信息
url = base_url + r'/asset_user/user_info.do'
resp = requests.get(url, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 资产新增
url = base_url + r'/asset/asset_new.do'
data = {
    'pageNo':'2'
}
resp = requests.get(url,params=data, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 资产修改
url = base_url + r'/asset/asset_update.do'
data = {
    'id':'1789',
    'pageNo':'2'
}
resp = requests.get(url, params=data, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 资产借用
url = base_url + r'/asset/asset_borrow.do'
data = {
    'id':'1789',
    'pageNo':'2'
}
resp = requests.get(url, params=data, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 存放地点
url = base_url + r'/asset_storage/asset_storage_list.do'
resp = requests.post(url, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 供应商新增
url = base_url + r'/asset_provider/asset_provider_new.do'
resp = requests.post(url, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 供应商修改
url = base_url + r'/asset_provider/asset_provider_update.do'
resp = requests.post(url, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)

# 供应商新增
url = base_url + r'/asset_provider/asset_provider_abandon.do'
resp = requests.post(url, cookies=cookies)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)